package util;

import javax.swing.ImageIcon;

public class ImageLoader {

    /**
     * Load an image relative to the images res/images/ folder 
     * @param path 
     * @return ImageIcon.
     */
    public static ImageIcon getImage(String path) {
        ImageIcon img;
        String fName = "./images/" + path;
        try {
            img = new ImageIcon(ClassLoader.getSystemResource(fName));
        } catch (Exception ex) {
            ex.printStackTrace();
            System.err.println(fName + " not loaded.");
            img = null;
        }
        return img;
    }
}
